$(function () {
    let $input = $("input[type='text'],input[type='password']");
    $input.on('blur', function () {
        let $el = $(this);
        let $parent = $el.parent();
        $parent.attr('class', 'frame-style').removeClass(' form-error');
        if ($el.val() === '') {
            $parent.attr('class', 'frame-style').addClass(' form-error');
        }
    });
    $input.on('focus', function () {
        let $el = $(this);
        let $parent = $el.parent();
        $parent.attr('class', 'frame-style').removeClass(' form-errors');
        if ($el.val() === '') {
            $parent.attr('class', 'frame-style').addClass(' form-errors');
        } else {
            $parent.attr('class', 'frame-style').removeClass(' form-errors');
        }
    });
});

function login() {
    let num = 0;
    let str = "";
    $("input[type$='text'],input[type$='password']").each(function (n) {
        if ($(this).val() === "") {

            layer.msg(str += "" + $(this).next().text() + "不能为空！\r\n", {
                icon: 0,
            });
            num++;
            return false;
        }
    });
    if (num > 0) {
        return false;
    }else{
        // 后台登录验证
    }
}
